import ajax from '../config/ajax'
import platform from '../config/platform'

const tip = '该平台' + platform.platform + '未实现';
const image1 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.juimg.com%2Ftuku%2Fyulantu%2F140703%2F330746-140F301555752.jpg&refer=http%3A%2F%2Fimg.juimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625729581&t=84ed98c1a6cfbe2f49835ef20b9dd4f6'
const image2 = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fyouimg1.c-ctrip.com%2Ftarget%2Ftg%2F035%2F063%2F726%2F3ea4031f045945e1843ae5156749d64c.jpg&refer=http%3A%2F%2Fyouimg1.c-ctrip.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1625729959&t=f1a87058f0b56711eb860439a13ab475'



export default {

	addNum({ commit, state }, id) {
		//点击下一题，记录答案id，判断是否是最后一题，如果不是则跳转下一题
		commit('REMBER_ANSWER', id);
		if (state.itemNum < state.itemDetail.length) {
			commit('ADD_ITEMNUM', 1);
		}
	},
	//初始化信息
	initializeData({ commit }) {
		commit('INITIALIZE_DATA');
	},


	// 开启页面下拉刷新
	base_addPullToRefresh() {
		window.zzcjsbridge.base_addPullToRefresh({
			'onPullEnd': 'window.onPullEnd',
			'success': (rsp) => { console.log('rsp' + rsp);alert(rsp);}
		});
	},

	// 收起页面刷新
	base_finishPullToRefresh() {
		window.zzcjsbridge.base_finishPullToRefresh({
			'success': (rsp) => {
				console.log('rsp' + rsp);
				alert(rsp);
			}
		});
	},

	// 移除页面下拉刷新
	base_removePullToRefresh() {
		if (platform.is_android) {
			window.zzcjsbridge.base_removePullToRefresh({
				'success': (rsp) => {
					console.log('rsp' + rsp);
					alert(rsp);
				}
			});
		} else {
			console.log(tip);
			alert(tip);
		}
	},

	// 显示原生loading
	base_startLoading() {
		window.zzcjsbridge.base_startLoading({
			'success': (rsp) => {
				console.log('rsp' + rsp);
				alert(rsp);
			}
		});
	},

	// 关闭原生loading
	base_stopLoading() {
		window.zzcjsbridge.base_stopLoading({
			'success': (rsp) => {
				console.log('rsp' + rsp);
				alert(rsp);
			}
		});
	},

	// 判断是否安装某app
	base_phoneIsExistApp() {
		// appNames 优先级大于appName，
		window.zzcjsbridge.base_phoneIsExistApp({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'appName': 'wechat',
			'appNames': ['wechat', 'tbopen', 'noInstallappID']
		});
	},

	// 安卓物理返回键点击
	base_listenBackButton() {
		if (platform.is_android) {
			window.zzcjsbridge.base_listenBackButton({
				'success': (rsp) => {
					console.log('rsp' + rsp);
					alert(rsp);
				}
			});
		} else {
			console.log(tip);
			alert(tip);
		}
	},

	// 请求位置信息返回定位数据(安卓)
	base_requestLocation_new() {
		if (platform.is_android) {
			window.zzcjsbridge.base_requestLocation_new({
				'success': (rsp) => {
					console.log('rsp' + rsp);
					alert(rsp);
				}
			});
		} else {
			console.log(tip);
			alert(tip);
		}
	},

	// 请求位置信息返回定位数据(iOS)
	base_requestLocation() {
		if (platform.is_android) {
			console.log(tip);
			alert(tip);
		} else {
			window.zzcjsbridge.base_requestLocation({
				'success': (rsp) => {
					console.log('rsp' + rsp);
					alert(rsp);
				}
			});
		}
	},

	// 驾车导航
	startNavigate() {
		window.zzcjsbridge.startNavigate({
			'success': (rsp) => {
				console.log(rsp);
				alert(rsp);
			},
			startPlace: "广州东站",
			endPlace: "目的地",
			//默认GPS,地球坐标系，国际通用坐标系
			startLng: "113.3212946287516",
			startLat: "23.149779128118247",
			endLng: "111.321294",
			endLat: "25.14977912",
			//火星坐标系，WGS84坐标系加密后的坐标系；Google国内地图、高德、QQ地图 使用
			aMapGps: { startLng: "", startLat: "", endLng: "", endLat: "" },
			//百度经纬度，BD09坐标系
			baiduGps: {},
		});
	},

	// 获取app版本
	getAppVersion() {
		window.zzcjsbridge.getAppVersion({
			'success': (rsp) => {
				console.log(rsp);
				alert(rsp);
			}
		});
	},

	// 开启微信app支付(待补充)
	pay_startWechatPay() {
		window.zzcjsbridge.pay_startWechatPay({
			'success': (rsp) => { console.log(rsp);alert(rsp);},
		});
	},

	// 检查支付平台是否存在
	pay_checkoutPlatform() {
		window.zzcjsbridge.pay_checkoutPlatform({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'platforms': ['alipay', 'wxpay', 'unionapp', 'applepay']
		});
	},

	// 返回到首页指定页面
	base_backToHome() {
		window.zzcjsbridge.base_backToHome({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'tabIndex': 'shouye'
		});
	},

	// 通知原生登录成功
	account_loginSuccess() {
		window.zzcjsbridge.account_loginSuccess({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'userID': '1213214',
			'token': 'vdjnsvasdc',
			'javaUserId': 'javaUserId',
			'javaToken': 'javaToken',
			'isBanana': 'isBanana',
			'channelId': 'channelId',
		});
	},

	// 通知原生登出成功
	account_logoutSuccess() {
		window.zzcjsbridge.account_logoutSuccess({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	//使用第三方授权登录
	account_appSocialSnsLogin() {
		window.zzcjsbridge.account_appSocialSnsLogin({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'platform': 'wechat',
		});
	},

	// 获取用户信息
	account_getInfo() {
		window.zzcjsbridge.account_getInfo({
			'success': (rsp) => { console.log(rsp); alert(rsp); }
		});
	},

	// 保存图片到相册
	base_saveToAlbum() {
		window.zzcjsbridge.base_saveToAlbum({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'imageUrl': image1
		});
	},

	// 跳转到图片浏览页
	imageviewer() {
		window.zzcjsbridge.imageviewer({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'photos': [{ 'url': image1 }, { 'url': image2 }],
			'showIndex': 1,

		});
	},

	// 分享接口
	base_share() {
		window.zzcjsbridge.base_share({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'title': "测试分享",
			'content': "测试分享",
			'photo': "",
			'shareUrl': image1,
			'sharePlatform': ["wxsession", "wxtimeline", 'copy'],
			'photoShareBase64': "",
			'photoSharePlatform': [],
			'onPhotoShare': ""
		});
	},

	// 设置状态栏样式
	base_setStatusColor() {
		window.zzcjsbridge.base_setStatusColor({
			'success': (rsp) => { console.log(rsp); alert(rsp);},
			'statusColor': 'transparent',
		});
	},

	// 剪贴板赋值
	base_setNativeClipboard() {
		window.zzcjsbridge.base_setNativeClipboard({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'content': '这是插件设置的剪贴板内容',
			'alertContent': '这是插件设置的剪贴板内容'
		});
	},

	// 获取剪贴板内容
	base_getNativeClipboard() {
		window.zzcjsbridge.base_getNativeClipboard({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
		});
	},


	// 原生支付
	nativePay() {
		window.zzcjsbridge.nativePay({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'channel': '',
			'type': '',
			'data': '',
			'url': '',
		});
	},

	// 返回上一页
	base_backToPreviousPage() {
		window.zzcjsbridge.base_backToPreviousPage({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'step': 0,
			'animation': true,
		});
	},

	// 获取系统版本
	getSystemVersion() {
		window.zzcjsbridge.getSystemVersion({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 开启小游戏页面
	openGamePage() {
		window.zzcjsbridge.openGamePage({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// H5调用原生返回N页
	base_goBackPage() {
		window.zzcjsbridge.base_goBackPage({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'step': 1
		});
	},


	// H5销毁指定URL页面
	base_destroyPage() {
		window.zzcjsbridge.base_destroyPage({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'urls': ['http://172.16.230.245:8090/']
		});
	},

	// 原生底部弹窗
	base_showNativeActionSheet() {
		window.zzcjsbridge.base_showNativeActionSheet({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'options': ['测试1', '测试2', '测试3'],
			'cancelButtonIndex': '取消',
			'destructiveButtonIndex': '关闭',
			'title': '提示'
		});
	},

	// iOS引导App Store评价
	base_rate() {
		if (platform.is_android) {
			console.log('该平台' + platform.platform + '未实现');
		} else {
			window.zzcjsbridge.base_rate({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		}
	},

	// 安卓去评价
	appRate() {
		if (platform.is_android) {
			window.zzcjsbridge.appRate({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		} else {
			console.log('该平台' + platform.platform + '未实现');
		}
	},

	// 选择图片上传(待补充)
	base_pickPhoto() {
		if (platform.is_android) {
			window.zzcjsbridge.base_pickPhoto({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		} else {
			console.log('该平台' + platform.platform + '未实现');
		}
	},

	// 扫码功能
	native_scan() {
		window.zzcjsbridge.native_scan({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'type': 'url',
			'base64Str': '',
			'imageUrl': image1,
			'jumpUrl': image2,

		});
	},

// ==================================本地存储=========================================================
	// 设置原生本地存储
	base_localStorageSetItem(){
		window.zzcjsbridge.base_localStorageSetItem({
			'success' : (rsp)=>{console.log(rsp);alert(rsp)},
			'namespace' : 'vipCard',
			'key' : 'testAppKey',
			'value' : 'testAppValue'
		});
	},

	// 获取原生本地存储
	base_localStorageGetItem(){
		window.zzcjsbridge.base_localStorageGetItem({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'namespace': 'vipCard',
			'key': 'testAppKey',
		});
	},

	// 清除公共存储空间
	base_localStorageClean(){
		window.zzcjsbridge.base_localStorageClean({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'namespace': 'vipCard',
		});
	},

	// 清除某key的存储空间
	base_localStorageRemoveItem(){
		window.zzcjsbridge.base_localStorageRemoveItem({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'namespace': 'vipCard',
			'key': 'testAppKey',
		});
	},

	// 获取公共存储空间
	base_localStorageAllItems(){
		window.zzcjsbridge.base_localStorageAllItems({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'namespace': 'vipCard',
		});
	},
	

/* ==================================第三方SDK====================================*/
	// 获取阿里百川授权信息
	alibc_login(){
		window.zzcjsbridge.alibc_login({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
		});
	},

	// 百川插件跳转淘宝
	showAli_TradePage_New(){

		let param = {
			'bizParams' :     {
				'extParams' :         {
					'flRate' : "1435.311000",
					'isvUserId' : "{\"uid\":1235821658879692800}",
					'materialDetail' : "{\"afterCouponPrice\":139.9,\"couponAmount\":0.0,\"originalPrice\":139.9,\"saveMoney\":20.08,\"unfreeDays\":8,\"userComissionTag\":\"20.08\",\"vipPrice\":119.82}",
					'pageType' : 'rebate'
				},
				'id' : '620586242574'
			},
			'code' : "suite://bc.suite.basic/bc.template.detail",
			'degradeType' : 0,
			'openType' : 0,
			'showParams' :     {
				'backUrl' : "alisdk://",
				'clientType' : 'taobao',
				'degradeUrl' : "",
				'title' : ""
			},
			'taokeParams' :     {
				'materialSourceUrl' : "https://detail.m.tmall.com/item.htm?id=620586242574",
				'pid' : "mm_376450199_439450211_110068000432",
				'relationId' : ""
			}
		};

		window.zzcjsbridge.showAli_TradePage_New({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'params' : param,
			'matchUrl' : ''
		});
	},

	// 打开京东主站页面
	jd_openAppWebViewPage(){
		let url = 'openapp.jdmobile://virtual?params=%7B%22category%22%3A%22jump%22%2C%22des%22%3A%22m%22%2C%22url%22%3A%22https%3A%2F%2Fccc-x.jd.com%2Fdsp%2Fcl%3Fposid%3D1999%26v%3D707%26union_id%3D1000023384%26pid%3D3586%26tagid%3D125304%26didmd5%3D__IMEI__%26idfamd5%3D__IDFA__%26did%3D__IMEIIMEI__%26idfa%3D__IDFAIDFA__%26oaid%3D__OAID__%26caid%3D__CAID__%26to%3Dhttps%253A%252F%252Fh5.m.jd.com%252FbabelDiy%252FZeus%252F2BYP5553186TfXdQPWUPo6DWaMVf%252Findex.html%253Fad_od%253D1%2526babelChannel%253Dttt2%22%2C%22m_param%22%3A%7B%22jdv%22%3A%22122270672%7Ckong%7Ct_1000023384_125304%7Czssc%7Cd36d13b9-61c4-4fdf-b7f2-11dbc28d14dd-p_1999-pr_3586-at_125304%22%7D%2C%22keplerFrom%22%3A%221%22%2C%22kepler_param%22%3A%7B%22source%22%3A%22kepler-open%22%2C%22otherData%22%3A%7B%22channel%22%3A%22b4dc3278288f4a25982ccdec07ebdc41%22%7D%7D%7D'
		window.zzcjsbridge.jd_openAppWebViewPage({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'url' : url
		});
	},

	//表示是否已经授权登录
	alibc_isLogin(){
		window.zzcjsbridge.alibc_isLogin({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
		});
	},

	/**============================================页面相关插件 ============================================*/
	// 控制键盘初始状态
	userVisitorMode(){
		window.zzcjsbridge.userVisitorMode({
			'success': (rsp) => { console.log(rsp); alert(rsp) },
			'channel_id': '',
			'speech_mode': true,
			'speech_send_type': 0,
			'first_input_status': 1,
		});
	},

	// 控制聊天输入框切换状态
	chat_switchInputToolStatus(){
		window.zzcjsbridge.chat_switchInputToolStatus({
			'input_status': 1,
			'success': function (rsp) {
				console.log(rsp);
				alert(rsp);
			}
		});
	},

	// 打开输入法(安卓)
	base_openKeyboard(){
		if (platform.is_android) {
			window.zzcjsbridge.base_openKeyboard({
				'success': (rsp) => { console.log(rsp); alert(rsp); }
			});
			return;
		}
		alert(tip);
	},



	// 以游客模式进入首页(app破墙之后去除)，后续开发基本无用
	jump_goVisitor(){
		window.zzcjsbridge.jump_goVisitor({
			'success': (rsp) => { console.log(rsp); alert(rsp); }
		});
	},

	// H5通过客户端进行网络请求
	fetchData(){
		window.zzc.call('fetchData', { 
					'url': 'https://imgcdn.chuxingyouhui.com/pintuan/mng/20190805/3e2d454bfc5c42b8b651adb6ac97dcea.jpeg',
					'dataType': 'base64', 
					'success': (rsp) => { console.log(rsp);alert(JSON.stringify(rsp));}
				});
	},

	/**============================================原生UI ============================================*/

	// 导航栏右侧浮出菜单
	base_navbarRightPopover(){
		window.zzcjsbridge.base_navbarRightPopover({
			'customItems': [{
				text: '文字', // 显示文本
				icon: '', // 可选参数，显示图片，支持本地图片名字参数和网络下载url
				color: '#ff0000' // 可选参数，配置文本和图片的颜色
				},
				{
					text: '文字1', // 显示文本
					icon: '', // 可选参数，显示图片，支持本地图片名字参数和网络下载url
					color: '#ff00aa' // 可选参数，配置文本和图片的颜色
				},
			],
			'success': (rsp) => { console.log(rsp); alert(JSON.stringify(rsp)); }
		});
	},

	// 调用原生toast
	base_toast(){
		window.zzcjsbridge.base_toast({
			'content' : 'toast文案',
			'time' : '3',
			'success': (rsp) => { console.log(rsp); alert(rsp); }
		});
	},

	// 控制界面滑动返回手势(iOS)
	base_controlLeftPanGesture(){
		window.zzcjsbridge.base_controlLeftPanGesture({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'off' : '1'
		});
	},

	// 设置页面标题
	base_webviewTitle(){
		window.zzcjsbridge.base_webviewTitle({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'title': "标题", //标题
			'color': "0x999999",
			// 'type' : 'button'
		});
	},


	// 置顶部导航栏的淡入淡出效果
	base_setTopNavbarFadeIn(){
		window.zzcjsbridge.base_setTopNavbarFadeIn({
			'startOffset' : 0,
			'endOffset' : 0,
			'success': (rsp) => { console.log(rsp); alert(rsp); }
		});
	},

	// 设置当前导航栏右侧按钮
	base_navbarRightButtons(){
		window.zzcjsbridge.base_navbarRightButtons({
			'success': (rsp) => { console.log(rsp); alert(rsp);},
			'items' : [{
				'topIcon': 'string', //可选，隐藏顶部栏时候配置的icon
				'text': '测试测试', // 显示的文字，优先级低于icon
				'textColor' : '0x999999',
				'imageW' : '80',
			}],
		});


		window.zzc.on('app:navbarRightButtonsClick',(rsp)=>{
			console.log('app:navbarRightButtonsClick' + JSON.stringify(rsp));
			alert(JSON.stringify(rsp));
		});
	},

	// 自定义导航栏右侧按钮
	base_customNavbarRightButton(){
		window.zzc.on('app:navbarRightButtonClick', (rsp) => {
			console.log('app:navbarRightButtonClick' + JSON.stringify(rsp));
			alert(JSON.stringify(rsp));
		});


		window.zzcjsbridge.base_customNavbarRightButton({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		 // 暂定只有两种类型 ， text 或者 image
			// 'imageUrl': 'https://m-dev.zuzuche.com/trip/v2/front-end/images/app-search.png',
			'text': "搜索",
			'textColor': '0x999999',
			'imageW' : 60 ,// 要显示的文字
			'onClick': 'app:navbarRightButtonClick'
		});
	},

	base_navbarLeftButtons(){
		window.zzc.on('app:navbarLeftButtonClick',(rsp)=>{
			console.log('app:navbarLeftButtonClick' + JSON.stringify(rsp));
			alert(JSON.stringify(rsp));
		});

		window.zzcjsbridge.base_navbarLeftButtons({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'items': [{
				'topIcon': 'string', //可选，隐藏顶部栏时候配置的icon
				'text': '测试测试', // 显示的文字，优先级低于icon
				'textColor': '0x999999',
				'imageW': '80',
				},{
					'text': '测试', // 显示的文字，优先级低于icon
					'textColor': '0x333333',
				}
		],
		});
	},

	// 顶部导航栏右侧功能按钮（只安卓）
	appCustomRightBarList(){
		let callBack = (rsp)=>{console.log(rsp);alert(rsp);}
		if (platform.is_android) {
			window.zzc.call('appCustomRightBarList',callBack);
		}else{
			console.log(tip);
			alert(tip);
		}
	},


	// 控制导航栏左侧按钮的隐藏于显示
	base_setTopBackBtnState(){
		if (platform.is_android) {
			console.log(tip);
			alert(tip);
		}else{
			window.zzcjsbridge.base_setTopBackBtnState({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
				'state': 'remove'
			})
		}
	},

	backToTop(){
		window.zzcjsbridge.backToTop({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	base_showNavigationBar(){
		window.zzcjsbridge.base_showNavigationBar({
			'show' : true,
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	base_reloadWebView(){
		window.zzcjsbridge.base_reloadWebView({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 隐藏三张电子卡
	hiddenPayCard(){
		window.zzcjsbridge.hiddenPayCard({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},
	// 发送一个原生通知
	postNotice(){
		window.zzcjsbridge.postNotice({
			'noticeName' : '123',
			'data' : {},
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 通用H5回调原生（目前只有省钱宝弹窗逻辑调用）
	base_h5ServicesCallback(){
		window.zzcjsbridge.base_h5ServicesCallback({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'data' : {},
			'id' : '',
			'api': 'h5AnalyseGoodsLink', 
		});
	},


	/**============================================热云统计 ============================================*/
	// 应用注册事件
	trackingIO_registerAccount(){
		window.zzcjsbridge.trackingIO_registerAccount({
			'success': (rsp) => {
				console.log(rsp); alert(rsp);
			},
			'account' : ''
		});
	},

	// 应用登录事件
	trackingIO_loginAccount(){
		window.zzcjsbridge.trackingIO_loginAccount({
			'success': (rsp) => {
				console.log(rsp); alert(rsp);
			},
			'account': ''
		});
	},

	// 开始支付行为上报
	trackingIO_startPay(){
		window.zzcjsbridge.trackingIO_startPay({
			'transactionId': '',
			'paymentType': '',
			'currencyType': 'CNY',
			'currencyAmount': 6666,
			'success': (rsp) => {
				console.log(rsp); 
				alert(rsp);
			}
		});
	},

	// 用户任意行为上报
	trackingIO_setEvent(){
		window.zzcjsbridge.trackingIO_setEvent({
			'eventName': 'click_btn',
			'extra': { 'name': 'zzc' },
			'success': (rsp) => {
				console.log(rsp);
				alert(rsp);
			}
		});
	},

	// 支付行为成功上报
	trackingIO_finishPay(){
		window.zzcjsbridge.trackingIO_finishPay({
			'transactionId': '',
			'paymentType': '',
			'currencyType': 'CNY',
			'currencyAmount': 6666,
			'success': (rsp) => {
				console.log(rsp);
				alert(rsp);
			}
		});
	},

	// trackingIO 设置属性
	trackingIO_setProfile(){
		window.zzcjsbridge.trackingIO_setProfile({
			'extra': {'name':'zzc'},
			'success': (rsp) => {
				console.log(rsp);
				alert(rsp);
			}
		});
	},

/**============================================广告插件 ============================================*/
 	// 激励视频
	playRewardAdVideo(){
		window.zzcjsbridge.playRewardAdVideo({
			'success': (rsp) => {
				console.log(rsp); alert(rsp);
			},
			'slotId': '945884767',
			'customData' : ''
		});
	},

	// banner
	showBannerAd(){
		window.zzcjsbridge.showBannerAd({
			'success': (rsp) => {console.log(rsp); alert(rsp);},
			'slotId': '945884907',
			'w' : '375',
			'h' : '90'
		});
	},

	// dismissBannerAd
	dismissBannerAd(){
		window.zzcjsbridge.dismissBannerAd({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// showFeedAd
	showFeedAd(){
		window.zzcjsbridge.showFeedAd({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'slotId': '945886990',
			'w': '360',
			'h': '90'
		});
	},

	// dismissFeedAd
	dismissFeedAd(){
		window.zzcjsbridge.dismissFeedAd({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},
	// 头条视频广告
	showDrawVideo(){
		window.zzcjsbridge.showDrawVideo({
			'duration' : '',
			'activityType' : '',
			'taskType' : '',
			'userTaskId' :'',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		})
	},

	// 头条信息流广告
	showNews(){
		window.zzcjsbridge.showNews({
			'duration': '',
			'activityType': '',
			'taskType': '',
			'userTaskId': '',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		})
	},
	// 阅盟
	showYmNovel(){
		window.zzcjsbridge.showYmNovel({
			'duration': '',
			'activityType': '',
			'taskType': '',
			'userTaskId': '',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		})
	},

	/**============================================CPS插件 ============================================*/
	// 跳转京东购物车
	fectchShoppingCartPage(){
		let jd = "https://u.jd.com/8OfQXi8?secondUrl=https%3A%2F%2Fp.m.jd.com%2Fcart%2Fcart.action%3Ffromnav%3D1%26st%3D1%26uabt%3D37_62%26d%3D%26cu%3Dtrue%26utm_source%3Dkong%26utm_medium%3Dtuiguang%26utm_campaign%3Dt_1001621024_1235821658879692800%26ZZCAppArg%3Dclearhistory%26enableRefresh%3D1&ZZCAppArg=AppOpenPage,wholePageSelfOpen,doNotCallJDApp&shortLocation=https%3A%2F%2Fchaoshi.jd.com%2F"
		window.zzcjsbridge.fectchShoppingCartPage({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'cartUrl' : jd,
			'showRuleTips' : true,
			'showBottomTips' : true,
			'useExchangePage' : false,
			'showRightRefresh' : true
		});
	},
	// 获取CPS订单详情
	fetch_orderData(){
		window.zzc.call('fetch_orderData', {
			url: 'https://h5.m.taobao.com/mlapp/odetail.html?hybrid=true&bizOrderId=1585147932757141930',
			type: '5',
			cookieNames: ['_nk_', '_w_tb_nick', 'dnk', 'lgc', 'tracknick'], // 校验客户端webview是否持有效登录，cookie name
			success: function (res) {
				console.log(res);
				alert(JSON.stringify(res));
			},
		});
	},


	// apply_orderData
	apply_orderData(){
		let orderList = [
			{
				"orderImg": "https://gd2.alicdn.com/imgextra/i3/307804503/O1CN01V4boXN1j8Q5NT7Osz_!!307804503.jpg_400x400.jpg", 
				"orderPrice": "398", 
				"orderStatus": "0", 
				"title": "夏季新品果绿色醋酸系带西装显瘦西服薄款气质阔腿裤垂感OL套装女"
			},
	];
		var paramStr = {"orderList": orderList,
                        "orderSn": "11211111111111",
                        "orderTime": "2021-04-23 11:50:00",
                        "parentOrderStatus": "0",
                        "payPrice": "398",
                        "payTime": "2021-04-23 12:00:00",
                        "shopTitle": "衣家伊人",
                        "source": 10
   			}
		window.zzcjsbridge.apply_orderData({
			'params' : JSON.stringify(paramStr),
			'success': (rsp) => { console.log(rsp); }
		});
	},



	// 获取设备类型
	getPhoneModel(){
		window.zzcjsbridge.getPhoneModel({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 推啊广告
	tuiAFetchCustomAd(){
		window.zzcjsbridge.tuiAFetchCustomAd({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'slotId': '348399'
		});
	},
	/**============================================日历插件 ============================================*/
	// 添加日历提醒
	saveContentToCalendar(){
		let date = new Date();
		console.log(date.getTime());
		let startTime = date.getTime() * 1000;
		let endTime = startTime + 3 * 60 * 1000;
		let id = startTime
		window.zzcjsbridge.saveContentToCalendar({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'id': id, //日历唯一id，必填
			'title': '标题',
			'content': '正文',
			'notes': '备注',
			'startDateTimestamp': startTime, //必填
			'endDateTimestamp': endTime, //必填
    		'alarmAheadMinute': '1', //必填
    		'repeatType':'1', // 必填// 0.永不，1.每日 2.每周 3.每月
    		'byDays':['TU'],//非必填, 数组//MO（周一）， TU（周二）， WE（周三）， TH（周四）， FR（周五）， SA（周六）， SU（周日）ps： ['TU', 'TH', 'SA']
    		'byMonthDays':['1','2'], //非必填，数组，//取值范围 1 - 31 ，ps： ['1', '2', '5']
			'url': 'https://www.baidu.com', // 非必填
		});
	},

	// 移除日历提醒
	removeContentFromCalendar(){
		window.zzcjsbridge.removeContentFromCalendar({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'id': '10086'
		});
	},

	// 检查是否在日历中
	checkContentInCalendar(){
		window.zzcjsbridge.checkContentInCalendar({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'id': '10086'
		});
	},


	/**============================================权限插件 ============================================*/
	// 检查是否开启某权限
	native_hasPermissions(){
		window.zzcjsbridge.native_hasPermissions({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'permissions': ['Location', 'Microphone', 'Camera', 'Photo', 'Push', 'Contact','Calendar']
		});
	},

	// 请求权限
	native_requestPermissions(){
		window.zzcjsbridge.native_requestPermissions({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'permission': 'Calendar',
		});
	},

	// 跳转到权限设置界面
	jump_permission_setting(){
		window.zzcjsbridge.jump_permission_setting({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 获取用户通信录信息
	requestUserContactBook(){
		window.zzcjsbridge.requestUserContactBook({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},
	// 添加通信录
	addUserContact(){
		window.zzcjsbridge.addUserContact({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'name' : '张三',
			'phoneNumber' : '10010000001'
		});
	},


	// 抖券播放广告视频(ios)
	native_playItem(){
		if (platform.is_android ) {
			alert(tip);
			console.log(tip);
		}else{
			window.zzcjsbridge.native_playItem({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
				'list' : {},
				'currentPlay' : '0',
				'currentPage' : '0',
				'catID' : ''
			});
		}
	},
	/**============================================登录及用户信息插件 ============================================*/
	// 拉起原生登录
	jumpLogin() {
		window.zzcjsbridge.jumpLogin({
			'targetUrl': 'https://www.baidu.com',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 更新用户信息
	updateUserInfo(){
		window.zzcjsbridge.updateUserInfo({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'data' : {}
		});
	},


	// growingIO
	growingIO(){
		window.zzcjsbridge.growingIO({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'action' : '',
			'dataStr' : ''
		});
	},

	// 分享
	shareWxMiniProgram(){
		window.zzcjsbridge.shareWxMiniProgram({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'base64Str' :'',
			'imageUrl' : '',
			'miniProgramId' : '',
			'programPath' : '',
			'webPageUrl' : '',
			'programPath' : '',
			'miniProgramType' : '',
			'shareTitle' : '',
			'shareMsg' : '',
		});
	},


	getPageVisibilityState(){
		window.zzcjsbridge.getPageVisibilityState({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},

	// 原生省钱宝弹窗
	fectchSqbSuperDialog(){
		window.zzcjsbridge.fectchSqbSuperDialog({
			'searchContent' : 'abc',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},
	// 打开小程序
	openMiniProgram(){
		window.zzcjsbridge.openMiniProgram({
			'platform' : '',
			'appId' : '',
			'path' : '',
			'type' : '',
			'url' : '',
			'success': (rsp) => { console.log(rsp); alert(rsp); },
		});
	},


	// 聊天输入框是否可用
	chat_cleanInputText(){
		window.zzcjsbridge.chat_cleanInputText({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'status' : '1'
		});
	},

	// iOS聊天收起键盘(iOS)
	appTextResignFirstResponder() {
		window.zzcjsbridge.appTextResignFirstResponder({
			'success': (rsp) => { console.log(rsp); alert(rsp); }
		});
	},

	// 正则表达式用于匹配用户聊天输入内容
	receiveSearchReg(){
		window.zzcjsbridge.receiveSearchReg({
			'success': (rsp) => { console.log(rsp); alert(rsp); },
			'search_reg' : [],
		});
	},


	// 获取设备mac，仅Android
	getMac() {
		if (platform.is_android) {
			window.zzcjsbridge.getMac({
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		}else{
			console.log(tip);
			alert(tip);
		}
	},

	// 处理Android滑动冲突
	ui_scrollHorizontalRect() {
		if (platform.is_android) {
			window.zzcjsbridge.ui_scrollHorizontalRect({
				'url': '',
				'rects': [],
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		}else{
			console.log(tip);
			alert(tip);
		}
	},

	// 更改顶部导航左侧功能按钮
	base_customNavbarLeftButton() {
		if (platform.is_android) {
			window.zzcjsbridge.base_customNavbarLeftButton({
				'type': '',
				'text': '',
				'imageUrl': '',
				'topImageUrl': '',
				'textColor': '',
				'imageW': '',
				'imageH': '',
				'onClick': '',
				'success': (rsp) => { console.log(rsp); alert(rsp); },
			});
		}else{
			console.log(tip);
			alert(tip);
		}
	},
}